<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>#springMessage("sysManagerTitle")</title> #parse("page_include.html")
</head>
<body>
	<div data-type="layout" data-defs="fit:true">
		<div data-defs="region:'north',border:true,split:true,title:'查询条件'"
			style="overflow-y: hidden; position: relative; height: 88px; padding: 0px">
			<form id="queryForm" method="post">
				<table class="stable" cellpadding="1" cellspacing="1" style="width: 100%">
					<tr>
						<td width="15%" class="stdlabel">#springMessage("processName")</td>
						<td width="15%" class="stdinput">
							<input data-type="inputbox" type="text" name="processName" data-defs="required:false"></input>
						</td>
						<td colspan="4">&nbsp;</td>
					</tr>
					<tr>
						<td colspan="4"></td>
						<td colspan="2">
							<div style="margin: 0px 0; padding-top: 5px;" align="right">
								<a id="queryButton" href="javascript:void(0)" data-type="button" data-defs="iconCls:'icon-search'">查询</a>
								<a id="clearButton" href="javascript:void(0)" data-type="button" data-defs="iconCls:'icon-reload'">清空</a>
							</div>
						</td>
					</tr>
				</table>
			</form>
		</div>
		<div data-defs="region:'center',title:'',border:true,split:true">
			<table id="processinstance_grid" data-type="grid" title="#springMessage('processInsInfo')" style="height: 500px"
				data-defs="
				method:'post',url: '${rc.contextPath}/activiti/getProcessInstances.do',idField:'instanceId',
				rownumbers:true, pagination:false, toolbar: '#tb1',singleSelect:true,border:false,
				onCheck:getProcessDiagram,
				fitColumns:true, fit:true">
				<thead>
					<tr>
						<!-- 流程实例ID -->
						<th data-defs="field:'processInstanceId',width:80,checkbox:true">processInstanceId</th>
						<!-- 流程定义ID -->
						<th data-defs="field:'processDefinitionId',width:200">#springMessage("processDefinitionId")</th>
						<!-- 活动ID -->
						<th data-defs="field:'activityId',width:200">#springMessage("activityId")</th>
						<!-- 是否完成 -->
						<th data-defs="field:'isEnd',width:200">#springMessage("isEnd")</th>
					</tr>
				</thead>
			</table>
			<div id="tb1" style="height: auto">
				<a id="addButton" href="javascript:void(0)" data-type="button" data-defs="iconCls:'icon-add',plain:true">#springMessage("buttonEnableProcess")</a>
				<a id="editButton" href="javascript:void(0)" data-type="button"
					data-defs="iconCls:'icon-edit',plain:true">#springMessage("buttonDisableProcess")</a>
			</div>
		</div>
	</div>
	<div id="process_diagram_window" data-type="window" data-defs="modal:true,closed:true,iconCls:'icon-edit'"
		style="width: 600px; height: 300px; padding: 10px;">
		<iframe id="processDiagramId" name="processDiagramId" src="${rc.contextPath}/assets/blank.html" width="100%"
			height="99.2%" style="overflow: auto;border:0" marginwidth="0" marginheight="0" scrolling="yes">
		</iframe>
	</div>
	<script type="text/javascript">
		//根据选择的人员信息获得人员的角色和资源信息
        function getProcessDiagram(index, data) {
	        var piid;
	        if (index == 0) {
		        piid = data.processInstanceId;
	        } else {
		        piid = data[index].processInstanceId;
	        }
	        var url = '${rc.contextPath}/activiti/toActiveProcessDiagramView.do?piid=' + piid;
	        $("#processDiagramId").attr("src", url);
	        
	        var options = {
	            "windowId" : "process_diagram_window",
	            "title" : "#springMessage('processDiagramInfo')"
	        };
	        openWindow(options);
        }
        $(document).ready(function() {
	        $("#clearButton").bind("click", function() {
		        $("#queryForm").form('clear');
	        });
	        $("#queryButton").bind("click", function() {
		        var formValues = JSON.stringify($("#queryForm").form('getValues'));
		        $('#processinstance_grid').grid('load', {
			        where : formValues
		        });
	        });
        });
	</script>
</body>
</html>